Repository navigation
feat(collaboration): add applyCspUpdate and buildCapReport hooks - #2
Merged
Merged
Conversation
Add SFVCspFields and SFVCapReport helpers and expose applyCspUpdate, getCspFields, and buildCapReport on SFVSimulationController and SFVBrowserController. applyCspUpdate normalizes pilot CspFields and records CSP_TELEMETRY_UPDATED with triggerDecision false so B1/B2 decisions stay unchanged. buildCapReport returns the cap_reports IPC shape used by the VQEG pilot harness. Add node --test coverage in test/csp-fields.test.js and test/cap-report.test.js. Field semantics and signaling levels are defined in VQEG cap-csp-collaboration-test-pilot (signaling.md, player-api.md). Python shared-table wiring lives in that repository; it merges first, then the pilot bumps this submodule in a follow-up pull request. Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds VQEG collaboration hooks to the SFV reference implementation so offline co-simulation and the browser player share the same CAP-facing surface:
applyCspUpdate(fields, time_s)stores a normalized CSP snapshot and emitsCSP_TELEMETRY_UPDATEDwithtriggerDecision: false.buildCapReport(time_s)returns the pilotcap_reportspayload (time_s,is_stalled,playable_buffer_s,current_video_id,swipe_rate_per_s).The VQEG NetworkStep harness in the pilot repo calls these methods each co-simulation step. The harness does not implement CAP/CSP policy; it forwards
step.collaborationand answerscap_reports. See collaboration.md.Behaviour change for existing scenarios: none at L0. B1/B2 still use download-history EWMA;
getCspFields()is available but unused until a later policy PR.Integration order (with the pilot)
cap-csp-collaboration-test-pilotv0.7.0onmain.SFV-Reference-Implementationmain.cap-csp-collaboration-test-pilotsfv-reference-implementationsubmodule to the merged commit;uv run pytest -qon the pilot.Reviewers can read steps 1 and 2 in parallel. Production-like pilot runs need step 3; step 1’s harness already documents the IPC contract step 2 implements.
Motivation
The pilot centralizes CAP–CSP state in a Python shared table and exposes filtered views on IPC. Previously, CAP reports were assembled in the legacy SFV-VQEG harness by scraping playback state, and CSP snapshots never entered the SFV engine.
Hooks in SFV core give:
SFVSimulationControllerandSFVBrowserController.collaboration.csp_by_ue).Observation.csp_fieldswithout a second telemetry bus in Node.The player never reads the shared table.
What changes
New modules (
src/core/)SFVCspFields.jsnormalizeCspFields,cspFieldsEqual— pilotCspFieldskeysSFVCapReport.jsbuildCapReportFromSession— pilotcap_reportsshapeControllers
SFVSimulationControllerapplyCspUpdate,getCspFields,buildCapReportSFVBrowserControllerRules context
SFVRulesContext.getCspFields()returns the latest snapshot ornull.CAP reports (co-sim)
getCapReportstiming.Pilot harness (after submodule bump)
In network_step_harness.js:
network_step:applyCspUpdate(csp_by_ue[ue], time_s)when present.cap_reportsIPC:buildCapReport(time_s)per started UE.Python:
SfVCapReporter→write_cap_report(unchanged once step 3 lands).Out of scope (this PR)
getCspFields()or setstriggerDecision: trueonCSP_TELEMETRY_UPDATED.oracle_capacity_trace, live HTTP adapter, dash.js catalogue work.5g-network-emulatorchanges.Test plan
Verified on the feature branch (hooks in
src/core/, controllers, and tests below) before opening the PR.node --test test/csp-fields.test.js test/cap-report.test.js— 4 passednpm test— 170 passed (~6.5 s); existing B1/B2 and scenario tests unchanged aside from the new modulesuv run pytest -qin cap-csp-collaboration-test-pilot — 62 passed with these hooks wired throughnetwork_step_harness.jsRelease gate for micseu remains
npm run verifyif the repository requires it; this PR was checked withnpm testonly.Remote / branch checklist
origin→git@github.com:micseu/SFV-Reference-Implementation.gitmainmain07fab25(v0.7.0) on pilotmasterLocal development in the pilot often points the submodule at a path clone with these commits; that layout is for integration testing, not for mixing SFV file changes into the pilot wiring PR.
Suggested merge note
Safe to merge as plumbing only: existing SFV validation and browser runs should match prior behaviour; pilot L0 determinism hashes should remain stable once the pilot submodule pointer is updated (step 3).